package com.inspur.xiaoju.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.inspur.xiaoju.common.ApiResponse;
import com.inspur.xiaoju.service.CaptchaService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


@RestController
@RequestMapping("/api/auth")
public class AuthController {
    
    @Autowired
    private CaptchaService captchaService;

    @PostMapping("captcha")
    public ApiResponse<Map<String, String>> captcha(@RequestBody Map<String, String> map) {
        return ApiResponse.success(captchaService.generateAndSaveCaptcha(map.get("captchaId")));
    }
    
}
